// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SourceFile

package com.sgame.android.data;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import com.sgame.android.data.Tunnel;
import com.sgame.android.MLog;

import org.json.JSONException;
import org.json.JSONObject;

// Referenced classes of package com.mobage.global.android.data:
//            TunnelTransmittable

public class Game
    implements Parcelable, TunnelTransmittable
{
    public static enum Field
    {
        UID, PUBLISHER, APP_STORE_URL, LARGE_ICON_URL, INSTALLED, TITLE, DESCRIPTION, PACKAGE_NAME, FEATURED_IMAGE_URL, ICON_URL, 
        APP_KEY, FEATURED;
    }


    public Game()
    {
    }

    public final String getTitle()
    {
        return mTitle;
    }

    public final String getAppKey()
    {
        return mAppKey;
    }

    public final String getIconUrl()
    {
        return mIconUrl;
    }

    public final void setInstalled(boolean flag)
    {
        mIsInstalled = flag;
    }

    public final String getPackageName()
    {
        return mPackageName;
    }

    private void getObject(JSONObject jsonobject)
    {
        try
        {
            mUid = jsonobject.getString(Field.UID.name());
            mTitle = jsonobject.getString(Field.TITLE.name());
            mDescription = jsonobject.getString(Field.DESCRIPTION.name());
            mPublisher = jsonobject.getString(Field.PUBLISHER.name());
            mAppStoreUrl = jsonobject.getString(Field.APP_STORE_URL.name());
            mAppKey = jsonobject.getString(Field.APP_KEY.name());
            mIconUrl = jsonobject.getString(Field.ICON_URL.name());
            mLargeIconUrl = jsonobject.getString(Field.LARGE_ICON_URL.name());
            mIsInstalled = jsonobject.optBoolean(Field.INSTALLED.name());
            mFeatured = jsonobject.getBoolean(Field.FEATURED.name());
            mFeaturedImageUrl = jsonobject.getString(Field.FEATURED_IMAGE_URL.name());
            mPackageName = jsonobject.getString(Field.PACKAGE_NAME.name());
            return;
        }
        catch(JSONException e)
        {
            MLog.e("Game, Error parsing game", e.getMessage());
        }
    }

    public int describeContents()
    {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int i1)
    {
    }

    private Game(byte byte0)
    {
    }

    public JSONObject toJson()
    {
    	JSONObject obj = new JSONObject();
        try
        {
            obj.put(Field.UID.name(), mUid);
            obj.put(Field.TITLE.name(), mTitle);
            obj.put(Field.DESCRIPTION.name(), mDescription);
            obj.put(Field.PUBLISHER.name(), mPublisher);
            obj.put(Field.APP_STORE_URL.name(), mAppStoreUrl);
            obj.put(Field.APP_KEY.name(), mAppKey);
            obj.put(Field.ICON_URL.name(), mIconUrl);
            obj.put(Field.LARGE_ICON_URL.name(), mLargeIconUrl);
            obj.put(Field.INSTALLED.name(), mIsInstalled);
            obj.put(Field.FEATURED.name(), mFeatured);
            obj.put(Field.FEATURED_IMAGE_URL.name(), mFeaturedImageUrl);
            obj.put(Field.PACKAGE_NAME.name(), mPackageName);
        }
        catch(JSONException e)
        {
            throw new RuntimeException(((Throwable) (e)));
        }
        return obj;
    }

    public String toJsonStringForTunnel()
    {
        return Tunnel.toString("Game", toJson());
    }

    public void updateWithJsonObjectFromTunnel(JSONObject jsonObject)
    {
        getObject(jsonObject);
    }

    Game(char c1)
    {
        this((byte)0);
    }

    private String mUid;
    private String mTitle;
    private String mDescription;
    private String mPublisher;
    private String mAppStoreUrl;
    private String mAppKey;
    private String mIconUrl;
    private String mLargeIconUrl;
    private boolean mIsInstalled;
    private boolean mFeatured;
    private String mFeaturedImageUrl;
    private String mPackageName;
    public static final android.os.Parcelable.Creator CREATOR = new android.os.Parcelable.Creator() {

        public final Object[] newArray(int i1)
        {
            return new Game[i1];
        }

        public final Object createFromParcel(Parcel parcel)
        {
            return new Game('\0');
        }

    };

}
